package Menus;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;

import FrameWork.Menu;
import FrameWork.Utilities;
import Main.SpaceGame;

public class ResourceMenu extends Menu
{
	int pixXPos = SpaceGame.windowXSize-200;
	int pixYPos = 30;
	int width = 200;
	int height = 75;
	int level = 0;
	int metalColorCnt = 0,bioColorCnt = 0;
	boolean cursorRequirement = false;
	SpaceGame main;
	public ResourceMenu(SpaceGame main) 
	{
		this.main = main;
	}
	
	public void draw(Graphics g)
	{
		g.translate(pixXPos, pixYPos);
		
		g.setColor(Color.LIGHT_GRAY);
		g.fillRect(0, -20, width, height+20);
		g.setColor(Color.DARK_GRAY);
		g.fillRect(5, 5, width-10, height-10);
		
		List<String> lines = new ArrayList<String>();
		List<Color>  colors= new ArrayList<Color>();
		
		colors.add(Color.cyan);
		lines.add("Metal: "+main.resources.getMetal());
		
		colors.add(Color.cyan);
		lines.add("Biomatter: "+main.resources.getBiomass());
		printLines(g, lines, colors);
		
		if(main.powerManager.getMaxPowerNodes()>= main.powerManager.getCurrentPowerNodes())
		{
			g.setColor(Color.lightGray);
			g.fillRect(10, Utilities.textInterval*3, width - 20, 15);
			g.setColor(new Color(main.powerManager.getCurrentPowerNodes()*255/main.powerManager.getMaxPowerNodes(),255-main.powerManager.getCurrentPowerNodes()*255/main.powerManager.getMaxPowerNodes(),0));
			int energyBarWidth = main.powerManager.getCurrentPowerNodes()*(width-24)/main.powerManager.getMaxPowerNodes();
			g.fillRect(12, Utilities.textInterval*3+2, energyBarWidth, 11);
		}
		else
		{
			g.setColor(Color.lightGray);
			g.fillRect(10, Utilities.textInterval*3, width - 20, 15);
			g.setColor(Color.gray);
			g.fillRect(12, Utilities.textInterval*3+2, width - 24, 11);
		}
		
		
		g.translate(-pixXPos, -pixYPos);
	}

	@Override
	public int getLevel() 
	{
		return level;
	}
	
	@Override
	public boolean requiresCursor() 
	{
		return cursorRequirement;
	}

	@Override
	public void setRequiresCursor(boolean f)
	{
		this.cursorRequirement = f;
	}
}
